/**
* @Author: Rain
* @Date: 2021-11-18 10:17:45
* @LastEditTime: 2023/11/10 23:13:37
* @Description: Do Something
 */
// 权限指令
import checkPer from '@/utils/permission'
import request from '@/utils/request'
import Element from 'element-ui'
import 'highlight.js/styles/atom-one-dark.css'
import Cookies from 'js-cookie'
//
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import 'normalize.css/normalize.css'
import Vue from 'vue'
// 代码高亮
import App from './App'
import './assets/icons' // icon
import './assets/tailwind.css'
import './assets/styles/element-variables.scss'
// global css
import './assets/styles/index.scss'
// 数据字典
import dict from './components/Dict'
import permission from './components/Permission'
import './router/index' // permission control
import router from './router/routers'
import store from './store'

Vue.use(checkPer)
Vue.use(mavonEditor)
Vue.use(permission)
Vue.use(dict)
Vue.use(Element, {
  size: Cookies.get('size') || 'small'
})

Vue.config.productionTip = false
Vue.prototype.$http = request
Vue.filter('imgTransform', (dataStr = '') => {
  if (dataStr.startsWith('blob')) {
    return dataStr
  }
  if (process.env.NODE_ENV === 'development') {
    const path =
      dataStr.indexOf('/home/eladmin/') > -1
        ? dataStr.replace('/home/eladmin/', `${process.env.VUE_APP_BASE_API}/`)
        : `${process.env.VUE_APP_BASE_API}/${dataStr}`
    return path
  } else {
    return dataStr
  }
})
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
